package com.ruoyi.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.zbg.MaintenanceStaffData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

public interface MaintenanceStaffDataMapper extends BaseMapper<MaintenanceStaffData> {
    @Insert("<script>" +
            "INSERT INTO maintenance_staff_data (district, tower_maintenance_staff, tower_contact, electric_maintenance_staff, electric_contact, " +
            "repair_home_manager, repair_home_contact, repair_group_manager, repair_group_contact, repair_wireless_manager, repair_wireless_contact, " +
            "repair_power_manager, repair_power_contact, repair_line_manager, repair_line_contact, repair_maintenance_manager, repair_maintenance_contact, " +
            "year, month) " +
            "VALUES (#{maintenanceStaffData.district}, #{maintenanceStaffData.towerMaintenanceStaff}, #{maintenanceStaffData.towerContact}, " +
            "#{maintenanceStaffData.electricMaintenanceStaff}, #{maintenanceStaffData.electricContact}, " +
            "#{maintenanceStaffData.repairHomeManager}, #{maintenanceStaffData.repairHomeContact}, " +
            "#{maintenanceStaffData.repairGroupManager}, #{maintenanceStaffData.repairGroupContact}, " +
            "#{maintenanceStaffData.repairWirelessManager}, #{maintenanceStaffData.repairWirelessContact}, " +
            "#{maintenanceStaffData.repairPowerManager}, #{maintenanceStaffData.repairPowerContact}, " +
            "#{maintenanceStaffData.repairLineManager}, #{maintenanceStaffData.repairLineContact}, " +
            "#{maintenanceStaffData.repairMaintenanceManager}, #{maintenanceStaffData.repairMaintenanceContact}, " +
            "#{maintenanceStaffData.year}, #{maintenanceStaffData.month}) " +
            "ON DUPLICATE KEY UPDATE " +
            "tower_maintenance_staff = VALUES(tower_maintenance_staff), " +
            "tower_contact = VALUES(tower_contact), " +
            "electric_maintenance_staff = VALUES(electric_maintenance_staff), " +
            "electric_contact = VALUES(electric_contact), " +
            "repair_home_manager = VALUES(repair_home_manager), " +
            "repair_home_contact = VALUES(repair_home_contact), " +
            "repair_group_manager = VALUES(repair_group_manager), " +
            "repair_group_contact = VALUES(repair_group_contact), " +
            "repair_wireless_manager = VALUES(repair_wireless_manager), " +
            "repair_wireless_contact = VALUES(repair_wireless_contact), " +
            "repair_power_manager = VALUES(repair_power_manager), " +
            "repair_power_contact = VALUES(repair_power_contact), " +
            "repair_line_manager = VALUES(repair_line_manager), " +
            "repair_line_contact = VALUES(repair_line_contact), " +
            "repair_maintenance_manager = VALUES(repair_maintenance_manager), " +
            "repair_maintenance_contact = VALUES(repair_maintenance_contact)" +
            "</script>")
    int saveOrUpdate(@Param("maintenanceStaffData") MaintenanceStaffData maintenanceStaffData);

}